package Assignment;

import javax.swing.ImageIcon;
import java.util.Random;


/*海洋对象*/
public abstract class SeaObject {
    public static final int LIVE = 0;
    public static final int DEAD = 1;
    public int state = LIVE;


    protected int width;
    protected int height;
    protected int x;
    protected int y;
    protected int speed;

    public abstract void move();
    public abstract ImageIcon getImage();
    public boolean isLive(){return state==LIVE;}
    public boolean isDead(){return state==DEAD;}


    SeaObject(int width,int height){
        this.width = width ;
        this.height =height;
        x = -width;
        Random rand = new Random();
        y =rand.nextInt(479-height-150+1)+150;

    }

    SeaObject(int width,int height,int x,int y ,int speed){
        this.width = width;
        this.height = height;
        this.x = x;
        this.y = y;
        this.speed = speed;
    }

}

